package byx.container.annotation.extension.impl;

import byx.container.annotation.annotation.Order;
import byx.container.annotation.extension.core.ParameterHandler;
import byx.container.annotation.extension.core.ParameterInfo;
import byx.container.core.Container;
import byx.container.core.ObjectFactory;

import static byx.container.core.ObjectFactories.value;

@Order(Integer.MAX_VALUE - 1)
public class ContainerParameterHandler implements ParameterHandler {
    @Override
    public boolean support(ParameterInfo param) {
        return param.getParameterType() == Container.class;
    }

    @Override
    public ObjectFactory<?> handle(ParameterInfo param, Container container) {
        return value(container);
    }
}
